package com.jiji.miaosha.mapper;

import com.jiji.miaosha.entity.User;
import com.jiji.miaosha.mapper.provide.UserMapperProvider;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    @Select("select * from user_info where id=#{userId}")
    User queryUserById(@Param("userId") Integer id);

    @InsertProvider(type = UserMapperProvider.class,method = "upSert")
    @Options(useGeneratedKeys = true, keyProperty = "user.id")
    int upSert(@Param("user") User user);

    @InsertProvider(type = UserMapperProvider.class,method = "insertSelective")
    @Options(useGeneratedKeys = true, keyProperty = "user.id")
    int insertSelective(@Param("user")User user);

    @Select("select * from user_info where telephone=#{telephone}")
    User queryUserByTelephone(@Param("telephone") String telephone);
}
